echo "Starting the second database encryption script."

cd /
ecryptfs-mount-private
cd ~
sudo stop mysql
sudo mv /var/lib/mysql /home/tfuser/Private
sudo ln -s /home/tfuser/Private/mysql /var/lib/mysql
sudo chown -h mysql:mysql /var/lib/mysql
sudo sed -i '25 a\
  /home/vagrant/Private/mysql/ r,\
  /home/vagrant/Private/mysql/** rwk,' /etc/apparmor.d/usr.sbin.mysqld
sudo /etc/init.d/apparmor restart
sudo chmod 755 /home/tfuser/Private
sudo start mysql

echo "You did it! The database should be encrypted."
